package com.qdlc.p2p.biz.service.lottery;

import java.text.MessageFormat;

import com.qdlc.p2p.biz.zdata.LotteryResult;
import com.qdlc.p2p.common.constant.LotteryType;

/**
 * Created by hongbl on 2016/2/1.
 * 抽奖信息创建工厂,根据奖项类别返回抽奖信息
 */
public class LotteryMessageFactory {
    public static LotteryResult setMessage(LotteryResult lotteryResult){
        int type = lotteryResult.getType();
        String message = null;
        switch (type) {
            case LotteryType.TYPE_SCORE:
                //获得积分
                message = MessageFormat.format("恭喜您！您获得了{0}个积分！",Double.valueOf(lotteryResult.getValue()).intValue());
                break;
            case LotteryType.TYPE_MONEY:
                //获得现金
                message = MessageFormat.format("恭喜您！您获得了{0}元现金！",lotteryResult.getValue());
                break;
            case LotteryType.TYPE_EXPERIENCE_COUPON:
                //体验金
                message = MessageFormat.format("恭喜您！您获得了{0}元体验金！",Double.valueOf(lotteryResult.getValue()).intValue());
                break;
            case LotteryType.TYPE_MOVIE_TICKETS:
                // 电影票
                message = "恭喜您！您获得了一张电影票！";
                break;
            case LotteryType.TYPE_RED_ENVELOPE:
                // 现金红包
                message =  MessageFormat.format("恭喜您！您获得了{0}元现金红包！",Double.valueOf(lotteryResult.getValue()).intValue() );
                break;
            case LotteryType.TYPE_VIRTUAL_RED_ENVELOPE:
                // 虚拟红包
                message = MessageFormat.format("恭喜您！您获得了{0}元投资红包！", Double.valueOf(lotteryResult.getValue()).intValue());
                break;
            case LotteryType.TYPE_UP_RATE:
                // 加息券
                message =   MessageFormat.format("恭喜您！您获得了{0}%加息券！", lotteryResult.getValue());
                break;
            case LotteryType.TYPE_LOTTERY:
                // 抽奖机会
                message = MessageFormat.format("恭喜您！您获得了{0}次抽奖机会！", Double.valueOf(lotteryResult.getValue()).intValue());
                break;
            case LotteryType.TYPE_COMMODITY:
                // 商品
                message =  MessageFormat.format("恭喜您！您获得了{0}！",lotteryResult.getName());
                break;
            default:
                message = "非常遗憾您未中奖！";
                break;
        }
        lotteryResult.setMessage(message);
        return lotteryResult;
    }
}
